//
// Created by deepin on 2020/10/28.
// probability可能性 choices选择 picks挑选 allowed允许
#include <iostream>
using namespace std;
long double probability(unsigned numbers, unsigned picks);
/*int main()
{
    double total,choices;
    cout << "Enter the total number of choices on the game\n"
            "the number of picks allowed:\n";
    while ((cin>>total>>choices) && choices<= total)
    {
       cout << "You have one chance in ";
       cout << probability(total,choices);
       cout << "of winning.\n";
       cout << "Next two number (q to quit):";
    }
    cout << "bye\n";
    return 0;
}*/

long double probability(unsigned numbers , unsigned picks)
{
    long double result = 1.0;
    long double n;
    unsigned p;

    for(n=numbers,p=picks;p>0;n--,p--)
        result = result*n/p;
    return result;
}
